(function () {
    var $C = YAHOO.util.Connect;
    var $D = YAHOO.util.Dom;
    var $E = YAHOO.util.Event;
    var _4 = YAHOO.util.KeyListener;
    var _5 = YAHOO.env.ua.ie;
    var _6 = (_5 == 6);
    var _7 = YAHOO.env.ua.gecko;
    var _8 = YAHOO.env.ua.webkit;
    var _9 = YAHOO.env.ua.opera;
    var _a = YAHOO.lang.isString;
    var _b = YAHOO.lang.trim;
    MT.app.Deal = {
        refresh: function (_c, _d) {
            var _e = 60;
            var _f = 5;
            var max = 300;
            var _11 = $D.get("deal-timeleft");
            var _12 = $D.hasClass(_11, "deal-on");
            var _13 = $D.get("deal-status");
            var _14 = $D.get("counter");
            var _15 = $D.get("counter-hour");
            var _16 = $D.get("counter-minute");
            var _17 = $D.get("counter-second");
            var _18 = null;
            var _19 = null;
            var _1a = 86400;
            if (_12) {
                var _1b = _11.getAttribute("diff");
                countTime(_1b);
            }
            else {
                _e = max;
                if (!_d) {
                    return;
                }
            }
            _18 = window.setInterval(check, _e * 1000);
            function check() {
                $C.asyncRequest("GET", "/deal/status/" + _c, {
                    success: function (o) {
                        handleResponse(o);
                    }, failure: function (o) { }
                });
            }
            function handleResponse(o) {
                var res = MT.util.getEvalRes(o);
                if (res.status) {
                    if (res.data["open"]) {
                        _13.innerHTML = res.data["html"];
                    }
                    else {
                        if (_12) {
                            window.location.reload();
                            return;
                        }
                        else {
                            var _20 = res.data["timeleft"];
                            if (_1a > _20) {
                                _1a = _20;
                                window.clearTimeout(_19);
                                _19 = window.setTimeout(function () {
                                    window.location.reload();
                                }, _20 * 1000);
                            }
                        }
                    }
                }
                window.clearInterval(_18);
                if (_e < max) {
                    _e += _f;
                }
                _18 = window.setInterval(check, _e * 1000);
            }
            function countTime() {
                if (_1b < 1) {
                    window.location.reload();
                    return;
                }
                var day = parseInt(_1b / (60 * 60 * 24), 10);
                var _22 = parseInt((_1b / (60 * 60)) % 24, 10);
                var _23 = parseInt((_1b / 60) % 60, 10);
                var _24 = parseInt(_1b % 60, 10);
                var _25 = [];
                if (day > 0) {
                    _25.push("<li><span>" + day + "</span>\u5929</li>");
                    _25.push("<li><span>" + _22 + "</span>\u5c0f\u65f6</li>");
                    _25.push("<li><span>" + _23 + "</span>\u5206\u949f</li>");
                }
                else {
                    _25.push("<li><span>" + _22 + "</span>\u5c0f\u65f6</li>");
                    _25.push("<li><span>" + _23 + "</span>\u5206\u949f</li>");
                    _25.push("<li><span>" + _24 + "</span>\u79d2</li>");
                }
                _14.innerHTML = _25.join("");
                _1b--;
                window.setTimeout(countTime, 1000);
            }
        }
, toggle: function (_26, _27) {
    _26 = $D.get(_26);
    _27 = $D.get(_27);
    $E.on(_26, "click", function (e) {
        _27.style.display = $D.getStyle(_27, "display") == "none" ? "block" : "none";
    });
}
, toggleOtherShare: function (_29) {
    var _2a = $D.get("deal-share-im");
    var _2b = $D.get("deal-share-im-c");
    var _2c = $D.get("sidebar");
    $E.on(_2a, "click", function (e) {
        var _2e = $D.getStyle(_2b, "display") == "none";
        _2b.style.display = _2e ? "block" : "none";
        if (_29) {
            _2c.style.marginTop = _2e ? "70px" : "0px";
        }
    }
);
}, mailto: function (el) {
    el = $D.get(el);
    var _30 = el.getAttribute("href");
    var _31 = _30.match(/\?subject=(.+)&body/)[1];
    var _32 = _30.match(/&body=(.+)/)[1];
    $E.on(el, "click", function (e) {
        try {
            var _34 = new ActiveXObject("Outlook.Application");
            var _35 = _34.getNameSpace("MAPI");
            var _36 = _34.CreateItem(0);
            $E.stopEvent(e);
            _36.Subject = _31;
            _36.To = "";
            _36.HTMLBody = _32;
            _36.Display(0);
        }
        catch (e) { }
    });
}, check: function () {
    if (_5) {
        fixLableImage();
    }
    function fixLableImage() {
        $E.on(["check-alipay-l", "check-chinabank-l"], "click", function (e) {
            $D.get(this.parentNode.htmlFor).checked = true;
        });
    }
}, removeGuide: function () {
    $E.on("sysmsg-guide-close", "click", function (e) {
        var _39 = this;
        $D.removeClass(document.body, "bg-newbie");
        _39.parentNode.style.display = "none";
    });
}, addConsult: function () {
    var _3d = $D.get("consult-add-succ");
    var _3e = $D.get("consult-add-more");
    var _3f = $D.get("consult-add-form");
    $E.on(_3f, "submit", function (e) {
        $E.stopEvent(e);
        $C.setForm(this);
        if (!this.question.value) {
            return alert("\u95ee\u9898\u4e0d\u80fd\u4e3a\u7a7a!");
        }
        var _41 = $C.asyncRequest("POST", _3f.action, {
            success: handleResponse, failure: function (o) { }
        });
        return true;
    });
    $E.on(_3e, "click", function (e) {
        $E.stopEvent(e);
        _3f.style.display = "block";
        _3d.style.display = "none";
    });
    function handleResponse(o) {
        var res = MT.util.getEvalRes(o);
        if (res.status) {
            _3f.style.display = "none";
            _3d.style.display = "block";
            MT.util.Effect.yellowFadeIn(_3d);
        }
        else {
            alert(res.msg);
        }
    }
}
    };
    MT.app.Deal.buy = function (_46, _47, _48) {
        var _49 = $D.get("deal-buy-form");
        var _4a = $D.get("ctl00_ctl00_cphMain_cphDefault_txtQuantity");
        var _4b = $D.get("ctl00_ctl00_cphMain_cphDefault_txtMobile");
        var _4c = $D.get("deal-buy-mobile-tip");
        var _4d = $D.get("deal-buy-type-select-t");
        var _4e = $D.get("deal-buy-type-select-b");
        var _4f = $D.get("deal-buy-quantity-login");
        var _50 = $D.get("deal-buy-quantity-signup");
        var _51 = /^\d{11}$/;
        var _52 = "\u8bf7\u8f93\u5165\u6b63\u786e\u768411\u4f4d\u624b\u673a\u53f7\u7801";
        var _53 = "\u8bf7\u9009\u62e9\u5546\u54c1\u7c7b\u578b";
        var _54 = _5 ? "propertychange" : "change";
        var _55 = "type-select-dialog";
        var _56 = null;
        function showError(_57) {
            MT.widget.showMessage("error", _57);
        }
        function setValue(el, _59) {
            if (el) {
                el.value = _59;
            }
        }
        function canBuy(e, _5b) {
            var _5c = parseInt(_4a.value, 10);
            var _5d = /^[0-9]+$/;
            var str;
            if (!_4a.value) {
                if (_5b) {
                    showError("\u8d2d\u4e70\u6570\u91cf\u4e0d\u80fd\u4e3a\u7a7a");
                }
                return false;
            }
            else {
                if (!_5d.test(_4a.value)) {
                    showError("\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u8d2d\u4e70\u6570\u91cf");
                    return false;
                }
            }
            if (_46) {
                if (_5c > _46) {
                    showError("\u672c\u5355\u53ea\u5269 " + _46 + " \u4ef6\u4e86");
                    return false;
                }
            } if (_47) {
                if (_5c > _47) {
                    str = "\u62b1\u6b49\uff0c\u6570\u91cf\u6709\u9650\uff0c\u60a8\u6700\u591a\u53ea\u80fd\u8d2d\u4e70 " + _47 + " \u4ef6";
                    showError(str);
                    return false;
                }
            }
            if (_5c < _48) {
                str = "\u60a8\u6700\u5c11\u9700\u8981\u8d2d\u4e70 " + _48 + " \u4ef6";
                showError(str);
                return false;
            }
            return true;
        }
        function fixNumber(_5f) {
            var str = _5f + "";
            var _61 = /\d+\.\d+/;
            if (_61.test(str)) {
                return Number(_5f).toFixed(2);
            }
            else {
                return _5f;
            }
        }
        function check(e) {
            if (!canBuy(e)) {
                return false;
            }
            MT.widget.removeMessage();
            var _63 = parseInt(_4a.value, 10);
            var _64 = $D.get("deal-buy-price").innerHTML;
            var _65 = _63 * _64;
            var _66 = $D.get("deal-buy-delivery-fee");
            var _67 = $D.get("delivery-discount-row");
            var _68 = $D.get("deal-buy-delivery-discount");
            var _69 = parseFloat($D.get("cardcode-row-t").innerHTML);
            var __69 = parseFloat($D.get("transfer-row-t").innerHTML);
            var _6a = _65 - _69 + __69;
            if (_66) {
                _6a += parseFloat(_66.innerHTML, 10);
            }
            if (_67) {
                var _6b = _67.getAttribute("sdata");
                if (_6b > 0 && _63 >= _6b) {
                    _6a -= parseFloat(_68.innerHTML, 10);
                    _67.style.display = "";
                }
                else {
                    _67.style.display = "none";
                }
            }
            $D.get("deal-buy-total").innerHTML = fixNumber(_65);
            $D.get("deal-buy-total-t").innerHTML = fixNumber(_6a);
            setValue(_4f, _63); setValue(_50, _63);
            return true;
        }
        initEvent();
        function initEvent() {
            $E.on(_4a, "keyup", function (e) {
                if (_4a.value === "") {
                    return;
                }
                check(e);
            });
            $E.on(_4a, "click", function (e) {
                if (_4d) {
                    selectType();
                }
            });
            $E.on(_4a, "blur", function (e) {
                if (canBuy(e)) {
                    MT.widget.removeMessage();
                }
            });
            $E.on(_4b, "keyup", function (e) {
                if (_51.test(this.value)) {
                    MT.widget.removeMessage();
                }
            });
            $E.on(_4b, "blur", function (e) {
                if (_51.test(this.value)) {
                    MT.widget.removeMessage();
                }
                else {
                    if (this.value !== "") {
                        showError(_52);
                    }
                }
                _4c.style.color = "#666666";
            });
            $E.on(_4b, "focus", function (e) {
                _4c.style.color = "#000000";
            });
            $E.on(_4e, "click", function (e) {
                selectType();
            });
            $E.on(_4d, "focus", function (e) {
                selectType();
            });
            $E.on(_49, "submit", function (e) {
                $E.stopEvent(e);
                if (!canBuy(e, true)) {
                    return false;
                }
                if (_4b && !_51.test(_4b.value)) {
                    showError(_52); _4b.focus();
                    return false;
                }
                if (_4d && _4d.value === "") {
                    showError(_53); window.scrollTo(0, 0);
                    return false;
                }
                var _75 = $D.get("address-table");
                if (_75) {
                    if (MT.app.Deal.address.check()) {
                        _49["adrProvince"].value = _49["adrProvince-c"].value;
                        _49["adrCity"].value = _49["adrCity-c"].value;
                        _49["adrDistrict"].value = _49["adrDistrict-c"].value;
                    }
                    else {
                        return false;
                    }
                }
                var _76 = parseInt(_4a.value, 10);
                setValue(_4f, _76);
                setValue(_50, _76);
                this.submit();
                return true;
            });
        }
        function selectType() {
            var _77 = $D.get("deal-buy-type-select");
            var _78 = MT.util.decodeJSON(_77.getAttribute("stype"));
            var _79 = $D.get("deal-buy-type-select-t");
            var _7a = $D.get("deal-buy-type-select-b");
            var _7b = "\uff0c";
            var _7c = "*";
            if (!_56) {
                generateDialog();
            }
            else {
                _56.show();
            }
            function generateDialog() {
                _56 = MT.util.getCommonDialog(_55, {
                    width: "450px", fixedcenter: false
                });
                var _7d = ["<div class=\"\">"];
                _7d.push("<h3 class=\"head\">\u9009\u62e9\u7c7b\u578b<span class=\"close\">\u5173\u95ed</span></h3>");
                _7d.push("<div class=\"body" + (_78.length > 5 ? " long" : "") + "\">");
                _7d.push("<table class=\"list\" id=\"deal-type-select-list\">");
                _7d.push("<tr><th class=\"type\">\u7c7b\u578b</th><th class=\"desc\">\u8bf4\u660e</th><th class=\"quantity\">\u6570\u91cf</th></tr>");
                for (var i = 0; i < _78.length; i++) {
                    var t = _78[i];
                    var _80 = i % 2 ? " class=\"alt\"" : "";
                    _7d.push("<tr" + _80 + ">");
                    _7d.push("<td class=\"type\">");
                    _7d.push("<p class=\"text\">" + t["type"] + "</p>");
                    if (t["maxnumber"] && t["curnumber"] > t["maxnumber"] * 0.8) {
                        _7d.push("<p class=\"last\">\u5269\u4f59\u6570\u91cf\uff1a<strong>" + (t["maxnumber"] - t["curnumber"]) + "</strong></p>");
                    }
                    _7d.push("</td>");
                    _7d.push("<td class=\"desc\">");
                    _7d.push("<p class=\"text\">" + t["desc"] + "</p>");
                    _7d.push("</td>");
                    _7d.push("<td class=\"quantity\">");
                    _7d.push("<p class=\"input\">");
                    if (t["maxnumber"]) {
                        var _81 = t["maxnumber"] - t["curnumber"];
                        if (_81 > 0) {
                            _7d.push("<input type=\"text\" autocomplete=\"off\" class=\"f-text\" maxlength=\"4\" name=\"quantity\" value=\"\" stype=\"" + t["type"] + "\" smax=\"" + _81 + "\" />");
                        }
                        else {
                            _7d.push("\u5356\u5149\u4e86");
                        }
                    }
                    else {
                        _7d.push("<input type=\"text\" autocomplete=\"off\" class=\"f-text\" maxlength=\"4\" name=\"quantity\" value=\"\" stype=\"" + t["type"] + "\" />");
                    }
                    _7d.push("</p>");
                    _7d.push("<p class=\"error\"></p>");
                    _7d.push("</td>"); _7d.push("</tr>");
                }
                _7d.push("</table>");
                _7d.push("</div>");
                _7d.push("<p class=\"act\"><input id=\"deal-type-select-commit\" type=\"submit\" class=\"formbutton\" value=\"\u786e\u5b9a\" /></p>");
                _7d.push("</div>");
                _56.setContent(_7d.join(""));
                _56.open();
                _56.center();
                initEvent();
            }
            function initEvent() {
                var _82 = $D.get("deal-type-select-list");
                var _83 = $D.get("deal-type-select-commit");
                var _84 = $D.getElementsByClassName("f-text", "input", _82);
                var reg = /^\d+$/;
                var _86 = [];
                if (_79.value !== "") {
                    var _87 = _79.value.split(_7b);
                    for (var i = 0; i < _87.length; i++) {
                        var a = _87[i].split(_7c);
                        _86[a[0]] = a[1];
                    }
                }
                $D.batch(_84, function (el) {
                    var _8b = el.getAttribute("stype");
                    if (_86[_8b]) {
                        el.value = _86[_8b];
                    }
                    $E.on(el, "focus", function () {
                        checkTypeSelect(this);
                    });
                    $E.on(el, "blur", function () {
                        checkTypeSelect(this);
                    });
                });
                $E.on(_83, "click", function (e) {
                    var sum = 0; var _8e = [];
                    for (var i = 0, len = _84.length; i < len; i++) {
                        var el = _84[i];
                        if (checkTypeSelect(el)) {
                            var _92 = parseInt(el.value, 10);
                            if (_92 > 0) {
                                sum += _92;
                                _8e.push(el.getAttribute("stype") + _7c + _92);
                            }
                        }
                        else {
                            el.focus();
                            return;
                        }
                    }
                    if (sum > 0) {
                        _4a.value = sum;
                    }
                    _56.hide();
                    if (check(e)) {
                        _79.value = _8e.join(_7b);
                    }
                    else {
                        _4a.focus();
                    }
                });
            }
            function checkTypeSelect(el) {
                var _94 = el.value;
                var max = el.getAttribute("smax");
                var reg = /^\d+$/;
                if (!_94) {
                    hideError(el);
                    return true;
                }
                if (!reg.test(_94)) {
                    showError(el, "\u6570\u91cf\u5fc5\u987b\u4e3a\u6570\u5b57");
                    return false;
                }
                if (max) {
                    _94 = parseInt(_94, 10);
                    max = parseInt(max, 10);
                    if (_94 > max) {
                        showError(el, "\u8d85\u8fc7\u4e86\u5269\u4f59\u6570\u91cf");
                        return false;
                    }
                }
                hideError(el);
                return true;
            }
            function showError(el, _98) {
                var _99 = $D.getAncestorByTagName(el, "td");
                $D.getElementsByClassName("error", "p", _99, function (i) {
                    i.innerHTML = _98; i.style.display = "block";
                });
            }
            function hideError(el) {
                var _9c = $D.getAncestorByTagName(el, "td");
                $D.getElementsByClassName("error", "p", _9c, function (i) {
                    i.style.display = "none";
                });
            }
        }
        var _9e = $D.get("deal-buy-cardcode");
        var _9f = $D.get("deal-buy-cardcode-login");
        var _a0 = $D.get("deal-buy-cardcode-signup");
        var _a1 = $D.get("ctl00_ctl00_cphMain_cphDefault_txtCardCode");
        var _a2 = $D.get("cardcode-deal");
        var _a3 = $D.get("cardcode-verify");
        var _a4 = $D.get("cardcode-link");
        $E.on(_a4, "click", function (e) {
            _a4.blur();
            var el = $D.get("cardcode-link-t");
            var _a7 = $D.getStyle(el, "display") == "none";
            el.style.display = _a7 ? "block" : "none";
            if (_a7) {
                window.setTimeout(function () {
                    _a1.focus();
                }, 0);
            }
        });
        $E.on(_a3, "click", function (e) {
            if ($D.hasClass(_a3, "loading")) {
                return;
            }
            var _a9 = _a1.value;
            var _aa = "cardcode=" + _a9 + "&dealid=" + _a2.value;
            var _ab = $C.asyncRequest("POST", "/card/check", {
                success: function (o) {
                    var res = MT.util.getEvalRes(o);
                    if (res.status) {
                        _a3.style.visibility = "hidden";
                        _a1.disabled = true;
                        $D.addClass(_a1, "readonly");
                        $D.get("cardcode-row").style.display = "";
                        $D.get("cardcode-row-t").innerHTML = res.data;
                        $D.get("cardcode-row-n").innerHTML = _a9;
                        setValue(_9e, _a9);
                        setValue(_9f, _a9);
                        setValue(_a0, _a9);
                        check(e);
                    }
                    else {
                        showError(res.msg);
                        _a3.value = "\u786e\u5b9a";
                    }
                    $D.removeClass(_a3, "loading");
                    _a3.disabled = false;
                }, failure: function (o) {
                }
            }, _aa);
            if ($C.isCallInProgress(_ab)) {
                $D.addClass(_a3, "loading"); _a3.disabled = true; _a3.blur();
            }
        });
    };
    MT.app.Deal.address = (function () {
        var _af, _b0, _b1, _b2, _b3, _b4, _b5, _b6, _b7;
        var _b8, _b9, _ba, _bb, _bc;
        var _bd = null;
        var _be = "\u8bf7\u9009\u62e9\u7701";
        var _bf = "\u8bf7\u9009\u62e9\u5e02";
        var _c0 = "\u8bf7\u9009\u62e9\u5e02\u533a";
        var _c1 = "\u90ae\u653f\u7f16\u7801\u586b\u5199\u6709\u8bef,\u8bf7\u8f93\u51656\u4f4d\u90ae\u653f\u7f16\u7801";
        var _c2 = "\u8bf7\u586b\u5199\u8857\u9053\u5730\u5740\uff0c\u6700\u5c115\u4e2a\u5b57\uff0c\u6700\u591a\u4e0d\u80fd\u8d85\u8fc760\u4e2a\u5b57\uff0c\u4e0d\u80fd\u5168\u90e8\u4e3a\u6570\u5b57";
        var _c3 = "\u8bf7\u6b63\u786e\u586b\u5199\u59d3\u540d\uff0c\u6700\u5c11\u4e0d\u80fd\u4f4e\u4e8e2\u4e2a\u5b57\uff0c\u6700\u591a\u4e0d\u80fd\u8d85\u8fc715\u4e2a\u5b57";
        var _c4 = "\u7535\u8bdd\u53f7\u7801\u4e0d\u80fd\u5c11\u4e8e6\u4f4d";
        function getAttr(_c5, _c6) {
            return (_c5 && _c5.getAttribute(_c6)) ? _c5.getAttribute(_c6) : "";
        }
        function checkProvince() {
            if (_b2.value === "") {
                _ba.innerHTML = _be; _ba.style.display = "block";
                return false;
            }
            else {
                _ba.style.display = "none";
                return true;
            }
        }
        function checkCity() {
            if (_b3.options.length > 1 && _b3.value === "") {
                _ba.innerHTML = _bf;
                _ba.style.display = "block";
                return false;
            }
            else {
                _ba.style.display = "none";
                return true;
            }
        }
        function checkDistrict() {
            if (_b4.options.length > 1 && _b4.value === "") {
                _ba.innerHTML = _c0;
                _ba.style.display = "block";
                return false;
            }
            else {
                _ba.style.display = "none";
                return true;
            }
        }
        function checkZipcode() {
            if (!_b5.value || !_b5.value.match(/^\d{6}$/)) {
                _bb.innerHTML = _c1;
                _bb.style.display = "block";
                return false;
            }
            else {
                _bb.style.display = "none";
                return true;
            }
        }
        function checkDetail() {
            if (!_b1.value || (_b1.value.length < 5) || _b1.value.match(/^\d*$/)) {
                _b9.innerHTML = _c2;
                _b9.style.display = "block";
                return false;
            }
            else {
                _b9.style.display = "none";
                return true;
            }
        }
        function checkName() {
            if (!_b0.value || (_b0.value.length < 2) || (_b0.value.length > 15)) {
                _b8.innerHTML = _c3;
                _b8.style.display = "block";
                return false;
            }
            else {
                _b8.style.display = "none";
                return true;
            }
        }
        function checkPhone() {
            if (!_b6.value || !_b6.value.match(/^.{6,}$/)) {
                _bc.innerHTML = _c4;
                _bc.style.display = "block";
                return false;
            }
            else {
                _bc.style.display = "none";
                return true;
            }
        }
        function scrollToAddress() {
            window.scrollTo(0, $D.getY(_b7));
        }
        return {
            init: function () {
                _b7 = $D.get("address-table");
                if (!_b7) {
                    return;
                }
                _af = $D.get("deal-buy-form");
                _b0 = $D.get("address-name");
                _b8 = $D.get("address-name-error");
                _b1 = $D.get("address-detail");
                _b9 = $D.get("address-detail-error");
                _b2 = $D.get("address-province");
                _b3 = $D.get("address-city");
                _b4 = $D.get("address-district");
                _ba = $D.get("address-district-error");
                _b5 = $D.get("address-zipcode");
                _bb = $D.get("address-zipcode-error");
                _b6 = $D.get("address-phone");
                _bc = $D.get("address-phone-error");
                var _c7 = MT.data.location.relation;
                var _c8 = MT.data.location.name;
                var _c9 = _b7.getAttribute("isglobal") === "true";
                var _ca = _b7.getAttribute("sprovince");
                var _cb = _b7.getAttribute("scity");
                var _cc = _b7.getAttribute("sprovincelist");
                var _cd = _cc.length > 0 ? _cc.split(",") : null;
                var _ce = _af["adrProvince"].value;
                var _cf = _af["adrCity"].value;
                var _d0 = _af["adrDistrict"].value;
                var _d1 = $D.get("deal-buy-address-list");
                var _d2 = false; initCheck();
                if (!_d1) {
                    initLocation();
                    _d2 = true;
                    return;
                }
                initList();
                function initCheck() {
                    $E.on(_b2, "blur", function (e) {
                        checkProvince();
                    });
                    $E.on(_b3, "blur", function (e) {
                        checkCity();
                    });
                    $E.on(_b4, "blur", function (e) {
                        checkDistrict();
                    });
                    $E.on(_b5, "blur", function (e) {
                        checkZipcode();
                    });
                    $E.on(_b1, "blur", function (e) {
                        checkDetail();
                    });
                    $E.on(_b0, "blur", function (e) {
                        checkName();
                    });
                    $E.on(_b6, "blur", function (e) {
                        checkPhone();
                    });
                }
                function initList() {
                    var _da = _d1.getElementsByTagName("li");
                    var _db = _d1.getElementsByTagName("input");
                    $D.batch(_db, function (el) {
                        if (el.checked) {
                            _bd = el.parentNode;
                            $D.addClass(el.parentNode, "selected");
                        }
                        $E.on(el, "click", function (e) {
                            var _de = this.parentNode;
                            if (!_d2) {
                                window.setTimeout(function () {
                                    initLocation(); _d2 = true;
                                }, 0);
                            }
                            function __restore() {
                                _b0.value = getAttr(_bd, "sname");
                                _b1.value = getAttr(_bd, "saddress");
                                _b5.value = getAttr(_bd, "szipcode");
                                _b6.value = getAttr(_bd, "sphone");
                            }
                            if (this.id == "deal-buy-address-other") {
                                var _df = getAttr(_bd, "scity");
                                var _e0 = getAttr(_bd, "sprovince");
                                var _e1 = getAttr(_bd, "scity");
                                var _e2 = getAttr(_bd, "sdistrict");
                                if (_c9) {
                                    __restore();
                                    window.setTimeout(function () {
                                        createProvince(_e0);
                                        createCity(_e0, _e1);
                                        createDistrict(_e0, _e1, _e2);
                                    }, 0);
                                }
                                else {
                                    if (_cd) {
                                        if (MT.util.inArray(_e0, _cd)) {
                                            __restore();
                                            createProvince(_e0);
                                            createCity(_e0, _e1);
                                            createDistrict(_e0, _e1, _e2);
                                        }
                                        else {
                                            createProvince();
                                            createCity();
                                            createDistrict();
                                        }
                                    } else {
                                        if (_cb == _df) {
                                            __restore();
                                            window.setTimeout(function () {
                                                selectByValue(_b4, _e2);
                                            }, 0);
                                        } else {
                                            reset();
                                        }
                                    }
                                }
                                $D.getElementsByClassName("blk-error", "div", "address-table", function (el) {
                                    el.style.display = "none";
                                });
                                $D.get("address-table").style.display = "block";
                            }
                            else {
                                $D.get("address-table").style.display = "none";
                                _bd = _de;
                            }
                            $D.removeClass(_da, "selected");
                            $D.addClass(_de, "selected");
                        });
                    });
                }
                function initLocation() {
                    createProvince(_ce);
                    createCity(_ce, _cf);
                    createDistrict(_ce, _cf, _d0);
                    if (_c9) { }
                    else {
                        if (_cd) {
                            if (!MT.util.inArray(_ce, _cd)) {
                                if (_b2.options.length) {
                                    _b2.options[0].selected = true;
                                }
                                if (_b3.options.length) {
                                    _b3.options[0].selected = true;
                                }
                            }
                        }
                        else {
                            _b2.disabled = true;
                            _b3.disabled = true;
                        }
                    }
                    $E.on(_b2, "change", function (e) {
                        var _e5 = this.options[this.selectedIndex];
                        var _e6 = _e5.value;
                        if (_e6) {
                            createCity(_e6);
                            if (_b3.options.length == 2) {
                                _b3.options[1].selected = true;
                                createDistrict(_e6, _b3.options[1].value);
                                if (_b4.options.length == 2) {
                                    _b4.options[1].selected = true;
                                }
                            }
                            else {
                                _b4.options.length = 0; appendOption(_b4);
                            }
                        }
                        else {
                            _b3.options.length = 0;
                            _b4.options.length = 0;
                            appendOption(_b3);
                            appendOption(_b4);
                        }
                    });
                    $E.on(_b3, "change", function (e) {
                        var _e8 = this.options[this.selectedIndex];
                        if (_e8.value) {
                            createDistrict(_b2.value, _e8.value);
                        }
                        else {
                            _b4.options.length = 0; appendOption(_b4);
                        }
                    });
                    $E.on(_b4, "change", function (e) {
                    });
                }
                function reset() {
                    _b0.value = "";
                    _b1.value = "";
                    _b5.value = "";
                    _b6.value = "";
                    if (_b4.options.length) {
                        _b4.options[0].selected = true;
                    }
                }
                function selectByValue(_ea, _eb) {
                    if (!_ea) {
                        return;
                    }
                    for (var i = 0; i < _ea.options.length; i++) {
                        var _ed = _ea.options[i];
                        if (_ed.value == _eb) {
                            _ed.selected = true; break;
                        }
                    }
                }
                function createProvince(_ee) {
                    var _ef = false;
                    _b2.options.length = 0; appendOption(_b2);
                    for (var i in _c7) {
                        if (_cd && !MT.util.inArray(i, _cd)) {
                            continue;
                        }
                        if (_ee) {
                            _ef = i == _ee;
                        }
                        appendOption(_b2, i, _ef);
                    }
                }
                function createCity(_f1, _f2) {
                    var _f3 = false;
                    _b3.options.length = 0;
                    if (_cd && !MT.util.inArray(_f1, _cd)) {
                        return;
                    }
                    appendOption(_b3);
                    var _f4 = _c7[_f1];
                    if (_f4) {
                        for (var i in _f4) {
                            if (_f2) {
                                _f3 = i == _f2;
                            }
                            appendOption(_b3, i, _f3);
                        }
                    }
                }
                function createDistrict(_f6, _f7, _f8) {
                    _b4.options.length = 0;
                    if (_cd && !MT.util.inArray(_f6, _cd)) {
                        return;
                    }
                    appendOption(_b4);
                    var _f9 = _c7[_f6];
                    if (!_f9) {
                        return;
                    }
                    var _fa = _f9[_f7];
                    var _fb = false;
                    var _fc = new Date().getTime() < new Date(2010, 4, 24).getTime();
                    for (var i = 0, len = _fa.length; i < len; i++) {
                        if (_f8) {
                            _fb = _fa[i] == _f8;
                        }
                        if (_fa[i] === 310230 && _fc) {
                            continue;
                        }
                        appendOption(_b4, _fa[i], _fb);
                    }
                }
                function appendOption(el, id, _101) {
                    if (id) {
                        var text = _c8[id];
                        if (text) {
                            var opt = new Option(text, id);
                            if (_101) {
                                opt.selected = true;
                            }
                            el.options.add(opt);
                        }
                    }
                    else {
                        el.options.add(new Option("--", ""));
                    }
                }
                function checkProvinceInArray(id) {
                    if (!id) {
                        return false;
                    }
                    if (_cd && _cd.length) {
                        return MT.util.inArray(id, _cd);
                    } return true;
                }
            }, check: function () {
                var _105 = $D.get("deal-buy-form");
                var _106 = MT.util.getRadioValue(_105, "addressid");
                if (!_b7 || _106 > 0) {
                    return true;
                }
                if (!checkProvince()) {
                    scrollToAddress();
                    return false;
                }
                if (!checkCity()) {
                    scrollToAddress();
                    return false;
                }
                if (!checkDistrict()) {
                    scrollToAddress();
                    return false;
                }
                if (!checkZipcode()) {
                    scrollToAddress();
                    return false;
                }
                if (!checkDetail()) {
                    scrollToAddress();
                    return false;
                }
                if (!checkName()) {
                    scrollToAddress();
                    return false;
                }
                if (!checkPhone()) {
                    scrollToAddress();
                    return false;
                }
                return true;
            }
        };
    })();
})();
